using System;
using System.Collections.Generic;
using System.Text;

namespace AppExtensions.Exceptions
{
    [global::System.Serializable]
    public class WrongTypeParameterException<T> : Exception
    {
        //
        // For guidelines regarding the creation of new exception types, see
        //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
        // and
        //    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
        //

        private readonly static string message = "Parameter \"{0}\" is not convertible to type {1}.";

        //public WrongTypeParameterException() { }
        public WrongTypeParameterException(string parameterName) : this(parameterName, null) { }
        public WrongTypeParameterException(string parameterName, Exception inner) : base(string.Format(message, parameterName, typeof(T).ToString()), inner) 
        {
            this.parameterName = parameterName;
        }
        protected WrongTypeParameterException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context) { }

        private string parameterName;

        public string ParameterName
        {
            get { return parameterName; }
        }
	
    }
}
